﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="share.aspx.cs" Inherits="UI.share" %>
<%@ Import Namespace="Common" %>
<%@ Import Namespace="DAL" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"  name="viewport" />
    <title><%=active.Name %></title>
    <script src="system/js/jquery.min.js"></script>
    <script src="/js/jquery.cookies.min.js?v=1"></script>
    <script src="/js/md5.js"></script>
    <script src="/js/common.js"></script>
    <script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <script type="text/javascript" src="/js/fastclick.js"></script>
    <link rel="stylesheet" href="//cdn.bootcss.com/weui/1.1.1/style/weui.min.css">
    <link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css">
    <script src="/js/jquery-weui.js"></script>
    <style>
    /*
    img
    {
        width:100%;
        height:100%;
        object-fit: cover;
    }
    */
    body,html{padding:0px; margin:0px; width:100vw; height:100% ; background:#ffffff;}
    .hidden{display:none;}
    .active{width:100%; float:left;}
    .active .img{width:100%; float:left;}
    .active .img img{width:100%;}
    .active .title{width:100%; height:auto; text-align:center; float:left; margin-top:10px;}
    .active .title img{width:60%;}
    .active .context{width:100%; float:left; margin-top:10px; position:relative;}
    .active .context img{width:100%; float:left;}
    .active .context .text{width:80%; float:left; margin-top:10px; position:absolute; top:12%; left:10%;}
    .active .context .top{width:96%; margin-left:2%; float:left;}
    .active .context .middle{width:79%; margin-left:2%; background:url(/img/22.png);background-size:100%; float:left; padding-left:10%; padding-right:7%; font-size:14px; line-height:20px; }
    .active .context .bottom{width:96%; margin-left:2%; float:left;}
    .active .voice{width:100%; height:120px; margin-top:20px; float:left; text-align:center; position:relative;}
    .active .voice .sound{width:30vw; height:30vw; margin:0 auto; background:url(/img/voice.jpg); background-size:30vw 30vw; opacity:1; border-radius:15vw;  position:absolute; left:35vw; z-index:2;}
    .active .voice .praise{width:30vw; height:30vw; margin:0 auto; background:url(/img/praise.png); background-size:30vw 30vw; opacity:1; border-radius:15vw;  position:absolute; left:35vw; z-index:2;}
    .active .voice .praised{width:30vw; height:30vw; margin:0 auto; background:url(/img/praise2.png); background-size:30vw 30vw; opacity:1; border-radius:15vw;  position:absolute; left:35vw; z-index:2;}
    .active .voice .shadow{width:28vw; height: 28vw; margin:0 auto; border-radius: 14vw; background: #ff3d3d; position:absolute; left:36vw; top:1vw; z-index:1;}
    .active .player{width:90%; height:30px; line-height:30px; margin-top:10px; margin-left:5%; float:left; color:#ff3d3d; font-size:14px; text-align:center;}
    .active .player .square{width:100%; height:35px; float:left; border-raidus:3px; background-color:#a0e75a; color:#319002; font-size:14px; line-height:35px;}
    .active .player .square img{height:35px; float:right; margin-right:3px;}
    .active .footer{width:100%; float:left; margin-top:100px;}
    .active .footer img{width:100%; float:left;}
    .meng{background:#000000; opacity:0.5; width:100%; height:100%; position:fixed; top:0px; left:0px;  z-index:100;}
    .arrow{width:80%; position:fixed; top:0px; right:20px; z-index:101;}
    .arrow img{width:100%;}
    .hongbao{width:150px; position:fixed; top:10px; right:0px; z-index:100;}
    .hongbao img{width:150px}
    .over{width:150px; position:fixed; top:10px; right:0px;  z-index:100;}
    .jieshu{width:100%; position:fixed; bottom:0px; right:110px;  z-index:102;}
    .over img{width:100%;}
    .takemoney{width:100%; height:30px; font-size:30px; color:yellow; font-weight:bold; position:absolute; left:5px; top:80%; text-align:center; z-index:100;}
    .takemoney font{font-size:12px;}
    .usercenter{width:60px; height:60px; position:fixed; right:10px; bottom:10px; z-index:102;}
    .usercenter img{width:100%; height:100%;}
    .border-top{background:linear-gradient(180deg, #c6c6c6, #c6c6c6 50%, transparent 50%) top	left/ 100% 1px no-repeat,	linear-gradient(90deg,#c6c6c6, #c6c6c6 50%, transparent 50%) top	right / 0px 100% no-repeat,	linear-gradient(0,	#c6c6c6, #c6c6c6 50%, transparent 50%) bottom right / 100% 0px no-repeat,	linear-gradient(-90deg, #c6c6c6, #c6c6c6 50%, transparent 50%) bottom left/ 0px 100% no-repeat;border-left:0px; border-left:0px;	}
    .phone{width:100%; height:50px; position:fixed; z-index:99; bottom:0px; background-color:#fff;}
    .phone .left{width:50px; float:left;}
    .phone .left img{width:40px; margin-top:5px; margin-left:5px;}
    .phone .right{width:150px; float:left; position:relative;}
    .phone .right .num{width:150px; height:22px; font-size:18px; color:#4d4e4e; padding-top:3px;}
    .phone .right .tip{width:150px; height:20px; font-size:12px; color:#8c8d8d;}
    .phone .right .delete{width:20px; height:20px; position:absolute; right:8px; top:-10px;}
    .phone .right .delete img{width:15px; height:15px;}
    .ad{width:100%; height:auto; position:fixed; bottom:0px; z-index:101; font-size:0px; overflow:hidden;}
    .ad img{width:100%;}
    #iframe{width:100%; float:left;}
    .iframe{width:35% !important; height:100%;}
    .praisesuccess{width:100%; height:30px; float:left; color:green; font-size:24px; font-weight:bold; text-align:center;}
    .manling{width:100%; height:50px; line-height:50px; float:left;font-size:18px; font-weight:bold; text-align:center; color:#343434;}
    .manling font{color:#EB4E45;}
    .nopraise{width:100%; height:50px; line-height:50px; float:left;font-size:14px; text-align:center;}
    @-webkit-keyframes halo { 0% { opacity: 1;-webkit-transform: scale(1); }
    50% {opacity: 0; }
    100%{opacity: 0;-webkit-transform: scale(3.0); } }
    * {
    -webkit-touch-callout:none;
    -webkit-user-select:none;
    -khtml-user-select:none;
    -moz-user-select:none;
    -ms-user-select:none;
    user-select:none;
    
    }
    .ui-border-radius {
  border: 1px solid #6fb44d;
  border-radius: 4px; }
  @media screen and (-webkit-min-device-pixel-ratio: 2) {
    .ui-border-radius {
      position: relative;
      border: 0; }
      .ui-border-radius:before {
        content: "";
        width: 200%;
        height: 200%;
        position: absolute;
        top: 0;
        left: 0;
        border: 1px solid #6fb44d;
        -webkit-transform: scale(0.5);
        -webkit-transform-origin: 0 0;
        padding: 1px;
        -webkit-box-sizing: border-box;
        border-radius: 8px;
        pointer-events: none; } }
        
        .border-b{border-image: url() 10 repeat;
        border-style: solid;
        border-width:0px;
        border-bottom-width: 1px;
        }
        span img{width:20px;}
        
        
        .friendlist{width:90%; height:auto; margin-left:4%; float:left; border-radius:15px; border:3px solid #EB4D44; background-color:#fff; z-index:99999999;}
        .friendlist .title{width:95%; padding-left:3%; height:40px; line-height:40px; text-align:left; color:#343434; font-size:14px; float:left; margin-top:0px; }
        .friendlist .title font{color:#EB4E45;}
        .friendlist .list{width:95%; padding-left:5%; height:auto; float:left; margin-top:10px; }
        .friendlist .list .headimg{width:25%; height:60px; float:left; }
        .friendlist .list .headimg img{width:50px; height:50px; border-radius:50%; } 
        .friendlist .list .info{width:50%; height:60px; float:left; }
        .friendlist .list .info .name{width:100%; height:30px; float:left; overflow:hidden; }
        .friendlist .list .info .date{width:100%; height:30px; float:left; font-size:12px; color:gray;}
        .friendlist .list .state{width:20%; height:60px; float:left; font-size:14px; color:#EB4E45; text-align:right; }
        
        .mianfeiling{width:86%; height:auto; position:fixed; left:7%; top:20%; z-index:101;}
        .mianfeiling img{width:100%;}
        .mianfeiling .dian{width:100%; height:auto; position:absolute; text-align:center; top:45%; z-index:102; font-size:26px; color:red; font-weight:bold;}
        .mianfeiling .ling{width:75%; height:56px; line-height:28px; position:absolute; text-align:center; top:61%; z-index:102; font-size:18px; padding-left:20%; padding-right:5%; overflow:hidden;}
        
        .linghongbao{width:80%; height:auto; position:fixed; left:10%; top:20%; z-index:101;}
        .linghongbao img{width:100%;}
        .linghongbao .close{width:20px; height:20px; position:absolute; left:20px; top:20px;}
        .linghongbao .close img{width:20px; height:20px;}
        .linghongbao .mian{width:100%; height:auto; position:absolute; text-align:center; top:23%; z-index:103;}
        .linghongbao .mian img{width:100px; height:100px;}
        .linghongbao .daozhang{width:100%; height:auto; position:absolute; text-align:center; top:65%; z-index:103; color:#ffffff;}
        .linghongbao .daozhang font{font-size:34px; color:#f7f264;}
        .linghongbao .daozhang e{color:#f7f264;}
        .linghongbao .autoclose{width:100%; height:auto; position:absolute; text-align:center; top:85%; z-index:103; color:#ffffff; font-size:14px;}
        .autoclose2{width:100%; position:absolute; bottom:13px; right:8px; z-index:103; color:red; font-size:12px; text-align:right;}

         .article-tag__list{display:inline !important;}
        .rich_media_content{visibility:visible !important;}
    </style>
</head>
<body>
    <%if (!string.IsNullOrEmpty(CookieHelper.GetCookie("userid"))){ %>
    <a href="complain.aspx"><div style="width:30px; height:50px; position:absolute; right:10px; top:30%; font-size:12px; text-align:center;"><div style="float:left;"><img src="img/ts.png" style="width:100%;"/></div><div style="float:left; width:100%; text-align:center; margin-top:-8px; color:gray">投诉</div></div></a>
    <audio id="media" autoplay="autoplay"><source src="" type="audio/mpeg"/></audio>
    <div id='iframe' <%=(active.Link.Contains("rabbitpre") || active.Link.Contains("eqxiu") || active.Link.Contains("s.wcd.im"))?"style='margin-bottom:0px;'":"style='width:100%;height:100%;'" %>>
        <%if(!string.IsNullOrEmpty(active.Link)){ %>
        <% if(active.LinkText!=""){%>
            <%=active.LinkText%>
        <%}else{ %>
            <iframe id="iframes" src="<%=active.Link%>" scrolling="no" frameborder="0" style='width:100vw; height:100%; <%=(!active.Link.Contains("rabbitpre") && !active.Link.Contains("eqxiu"))?"min-height:720px;":""%>'></iframe>
        <%} %>
        <%} %>
        <%if (!active.Link.Contains("rabbitpre") && !active.Link.Contains("eqxiu") && !active.Link.Contains("s.wcd.im"))
          {%>
    <div class="active">
      <%if(string.IsNullOrEmpty(active.Link)){ %>
        <div class="img"><img src="<%=active.Img %>"/></div>
        <div class="title"><img src="/img/title.png"/></div>
        <div class="context">
            <div class="top"><img src="/img/11.png"/></div>
            <div class="middle">
            
            <div style="font-weight:bold; font-size:15px; padding-top:5px;">
            <%=active.Context%>
            </div>
            </div>
            <div class="bottom"><img src="/img/33.png"/></div>
        </div>

      <%} %>



        
        <div class="linghongbao hidden"><div class="close"><img src="/img/close.png" onclick="Hidden()"/></div><img src="/img/bg.png"/><div class="mian"><img src="/img/ling.gif"/></div><div class="daozhang"><font><%=prizemoney %></font><e>元</e>红包已到账</div><div class="autoclose"><e>5</e>秒后自动关闭</div></div>
        <%if(string.IsNullOrEmpty(active.Link)){ %>
        <div class="footer"><img src="/img/foot.png"/></div>
        <%} %>
    </div>
    <%} %>

    </div>
    
    

    <%if (!string.IsNullOrEmpty(active.Mobile) || (!string.IsNullOrEmpty(active.WeiXin) && active.WeiXin != Commons.domain) || (!string.IsNullOrEmpty(active.SkipLink) && active.SkipLink != Commons.domain))
      { %>
    <div class="ad"><img src="/img/ad.jpg?v=2"/>
    <%if(!string.IsNullOrEmpty(active.Mobile)){ %><div style="width:30px; height:30px; position:absolute; left:60px; top:5px; border-radius:15px;"><a href="tel:<%=active.Mobile %>"><img src="/img/mobile.png"/></a></div><%} %>
    <%if(!string.IsNullOrEmpty(active.WeiXin) && active.WeiXin!=Commons.domain){ %><div style="width:30px; height:30px; position:absolute; left:110px; top:5px; border-radius:15px;"><a onclick="Prev_Image('<%=active.WeiXin %>')"><img src="/img/weixin.png"/></a></div><%} %>
    <%if(!string.IsNullOrEmpty(active.SkipLink) && active.SkipLink!=Commons.domain){ %><div style="width:30px; height:30px; position:absolute; left:157px; top:5px; border-radius:15px;"><a href="<%=active.SkipLink %>"><img src="/img/link.png"/></a></div><%} %>
    <!--<div style="width:30px; height:30px; position:absolute; left:200px; top:5px; border-radius:15px;"><a href=""><img src="/img/address.png"/></a></div>-->
    </div>

    <%} %>

    <%if(pinfo.ShowPut == 1 && uinfo.EndDate<DateTime.Now){ %>
    <div class="usercenter"><a href="/alone.aspx?activeid=<%=active.ID %>"><img src="/img/usercenter.png"/></a></div>
    <%}
        if (pinfo.ShowPut == 1 && uinfo.EndDate > DateTime.Now)
          {
          %>
    <div class="usercenter"><a href="/member/index.aspx"><img src="/img/usercenter.png"/></a></div>
    <%} %>
    <%--<div class='meng <%=(active.PrizeType == 3 && active.State==1 && hastake==false) || active.State==2 || active.AllMoney==active.TakeMoney?"hidden":"" %>' onclick="Hidden_Meng(this)"></div>--%>

    <%if(active.State==2){ %>
    <div class="jieshu" onclick="Hidden(this)" style="width:100px; height:100px; right:190px;"><img src="/img/pause.png" style="height:100px !important;"/></div>
    <%}else{ %>
    <%if (hastake==false){ %>
    <%if ((active.PrizeType == 1 && active.AllMoney>active.TakeMoney)) { %>
    <div id="hongbao1" class="hongbao" onclick="Chai_HongBao()"><img src="/img/hongbaos1.png"/><div class="takemoney" style="top:50px; color:#f7f264;"><%=prizemoney %><font> 元</font></div></div>
    <%}if (active.PrizeType == 2 && active.AllMoney>active.TakeMoney) {  %>
    <!--<div id="arrow" class="arrow" onclick="Hidden(this)"><img src="/img/arrows.png"/></div>-->
    <div class="meng" onclick="Hidden()"></div>
    <div id="hongbao2" class="hongbao" onclick="Hidden(this)" style="top:10%; width:100%; height:80%; left:0%; "><img src="/img/hongbaos2.png?v=2" style="width:100%"/><div class="takemoney" style="top:10%; font-size:30px; color:#f7f264"><%=prizemoney %><font> 元</font></div></div>
    <%}if (active.PrizeType == 3 && active.AllMoney>active.TakeMoney) { %>
    <div id="hongbao1" class="hongbao hidden" onclick="Chai_HongBao()"><img src="/img/hongbaos1.png"/><div class="takemoney" style="top:50px; color:#f7f264"><%=prizemoney %><font> 元</font></div></div>
    <%}
        if (active.PrizeType <= 3 && active.AllMoney <= active.TakeMoney && active.ShowOver == 1)
      { %>
    <div class="jieshu" onclick="Hidden(this)" style="width:100px; height:100px;"><img src="/img/over.png?v=1" style="height:90px !important;" /></div>
    <%}}else{ %>
    <div class="over" onclick="Hidden(this)"><img src="/img/success.png"/><div class="takemoney" style="top:100px; color:#f7f264; font-size:20px;"><%=prizemoney %><font> 元</font></div></div>
    <%}} %>
    <%
        if(active.PrizeType >3 && active.State==3 && active.ShowOver==1){
    %>
    <div class="jieshu" onclick="Hidden(this)" style="width:100px; height:100px;"><img src="/img/over.png?v=1" style="height:90px !important;" /></div>
    <%}%>


    <div id="share_hongbao" style="width:80%; left:10%; top:20%; position:absolute; z-index:101; display:none;"><img src="/img/hongbao.gif" style="width:100%" onclick="Get_HongBao()"/></div>

    <div id="container" style="display: none;"></div>
    <iframe id="prize_record" style="display: none;"></iframe>
    <%} %>
    <script>
    function Get_HongBao(){
                var province = $.cookies.get("province");
                var city = $.cookies.get("city");
                var area = $.cookies.get("area");
                var lat = $.cookies.get("lat");
                var lng = $.cookies.get("lng");
                var address = $.cookies.get("address");
                    $(".meng").remove();
                    $("#share_hongbao,#hongbao2").hide();
                    if ("<%=active.State %>" == "2") {
                        $.alert("该活动已暂停");
                        return;
                    }
                    if ("<%=active.Sex %>" != "0" && "<%=active.Sex %>" != "<%=uinfo.Sex %>") {
                        if ("<%=uinfo.Sex %>" == "1") {
                            $.alert("该活动只允许女性参与");
                            return;
                        } else {
                            $.alert("该活动只允许男性参与");
                            return;
                        }
                    }
                    /*
                    if (parseInt("<%=active.PrizeType %>") <= 3 && "<%=active.State %>" == "1") {
                        $.showLoading("领取中");
                    }
                    if (parseInt("<%=active.PrizeType %>") > 3 && "<%=active.State %>" == "1") {
                        $.showLoading("分享中");
                    }
                    */
                    var data = {};
                    if ("<%=active.Range %>" == "2") {
                        if (province == "") {
                            $.alert("获取位置失败，请稍后重试");
                            return;
                        }
                        if ("<%=active.Province %>".indexOf(province) == -1 && province.indexOf("<%=active.Province %>") == -1) {
                            $.hideLoading();
                            $.alert("您不在活动范围之内");
                            return;
                        }
                    }
                    if ("<%=active.Range %>" == "3") {
                        if (city == "") {
                            $.alert("获取位置失败，请稍后重试");
                            return;
                        }
                        if ("<%=active.City %>".indexOf(city) == -1 && city.indexOf("<%=active.City %>") == -1) {
                            $.hideLoading();
                            $.alert("您不在活动范围之内");
                            return;
                        }
                    }
                    if ("<%=active.Range %>" == "4") {
                        if (area == "") {
                            $.alert("获取位置失败，请稍后重试");
                            return;
                        }
                        area = area.replace("县", "");
                        if ('<%=active.Area.Replace("县","") %>'.indexOf(area) == -1 && area.indexOf("<%=active.Area.Replace("县","") %>") == -1) {
                            $.hideLoading();
                            $.alert("您不在活动范围之内");
                            return;
                        }
                    }
                    if ("<%=active.Range %>" == "5") {
                        if (CalDistance(parseFloat("<%=active.Lat %>"), parseFloat("<%=active.Lng %>"), lat, lng) > parseInt("<%=active.Metre %>")) {
                            $.hideLoading();
                            $.alert("您不在活动范围之内");
                            return;
                        }
                    }

                        var data={};
                        data.act = "Save_PrizeRecord";
                        data.sid = "<%=active.ID %>";
                        data.userid = "<%=uinfo.ID %>";
                        data.createid = "<%=active.UserID %>";
                        data.money = "<%=prizemoney %>";
                        data.prizetype = "<%=active.PrizeType %>";
                        data.token = "<%=DESEncrypt.Encrypt(uinfo.ID.ToString()) %>";
                        data.openid = "<%=uinfo.OpenID %>";
                        data.flag = "share";
                        data.lat = lat;
                        data.lng = lng;
                        data.province = province;
                        data.city = city;
                        data.area = area;
                        data.address = address;
                        var list=new Array();
                        for(var key in data){//遍历json对象的每个key/value对,p为key
                            list.push(key+"="+data[key]);
                        }
                        $.showLoading("领取中...");
                        Ajax.Post("/tools/API.ashx", data, function(r){
                                $.hideLoading();
                                var json = $.parseJSON(r);
                                if (json.state) {
                                    toPlay();
                                    $("#hongbao2 .takemoney").remove();
                                    $("#hongbao2 img").attr("src", "/img/success.png");
                                    $("#hongbao2").append('<div class="takemoney" style="top:100px; color:#f7f264; font-size:20px;"><%=prizemoney %><font> 元</font></div>');
                                    $("body").append('<div class="meng" onclick="Hidden()"></div>');
                                    $.alert("领取成功，请返回聊天界面查收","消息",function(){
                                        Hidden();
                                    });

                                } else {
                                    alert(json.msg);
                                }
                                
                            });

        };

        if('<%=JobRequest.GetRequestString("from") %>'!=""){
            if($.cookies.get("userid")=="<%=uinfo.ID %>"){
                Get_HongBao();
            }else{
                window.location.href='activesss.aspx?id=<%=JobRequest.GetRequestString("id") %>&userid=<%=JobRequest.GetRequestString("userid") %>&rid=<%=JobRequest.GetRequestString("rid") %>';
            }
        }

        function toPlay() {
            var media = document.getElementById("media");
            media.src = "http://www.mengshen666.cn/img/ling.mp3";
            media.play();
        }
        function Hidden(o) {
            $(".meng,#hongbao2").fadeOut(300);
        };
    </script>
</body>
</html>